<?php

namespace App\Wechat\Remind\Models;

use Tymon\JWTAuth\Contracts\JWTSubject;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;

class User extends Authenticatable implements JWTSubject
{
	protected $connection = 'remind'; //连接不同的数据库，分别设置
	protected $table = 'wx_users'; //用户表，不同的用户表分别设置
	protected $primaryKey = 'openid'; //主键，jwt默认使用的id字段，这是laravel定的。修改这个属性后，可以用自定义的主键字段来检索用户
	public $incrementing = false; //如果非自增主键，需关掉，不然返回的值为0
	protected $guarded = [];

    use Notifiable;

	/**
	 * Get the identifier that will be stored in the subject claim of the JWT.
	 *
	 * @return mixed
	 */
	public function getJWTIdentifier()
	{
		return $this->getKey();
	}

	/**
	 * Return a key value array, containing any custom claims to be added to the JWT.
	 *
	 * @return array
	 */
	public function getJWTCustomClaims()
	{
		return [];
	}
}
